﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dropthings.DAL
{
    public class UQ_GetAmmeterMoneyInMonth : BaseQuery
    {
        public UQ_GetAmmeterMoneyInMonth(int year, int month, string identifyCode)
            : base()
        {
            StringBuilder sqlStr = new StringBuilder();
            sqlStr.Append("select ISNULL(SUM(MonthMoney), 0) AS Money FROM DB_AmmeterMonthDatas");
            sqlStr.AppendFormat(" where ReadingYear ={0}", year);
            sqlStr.AppendFormat(" and ReadingMonth ={0}", month);
            sqlStr.AppendFormat(" and IdentifyCode  ='{0}'", identifyCode);
            _QueryStringName = sqlStr.ToString();
        }
    }

    public class UQ_GetWaterMoneyInMonth : BaseQuery
    {
        public UQ_GetWaterMoneyInMonth(int year, int month, string identifyCode)
            : base()
        {
            StringBuilder sqlStr = new StringBuilder();
            sqlStr.Append("select ISNULL(SUM(MonthMoney), 0) AS Money FROM DB_WaterMonthDatas");
            sqlStr.AppendFormat(" where ReadingYear ={0}", year);
            sqlStr.AppendFormat(" and ReadingMonth ={0}", month);
            sqlStr.AppendFormat(" and IdentifyCode  ='{0}'", identifyCode);
            _QueryStringName = sqlStr.ToString();
        }
    }


    public class UQ_GetGasMoneyInMonth : BaseQuery
    {
        public UQ_GetGasMoneyInMonth(int year, int month, string identifyCode)
            : base()
        {
            StringBuilder sqlStr = new StringBuilder();
            sqlStr.Append("select ISNULL(SUM(MonthMoney), 0) AS Money FROM DB_GasMonthDatas");
            sqlStr.AppendFormat(" where ReadingYear ={0}", year);
            sqlStr.AppendFormat(" and ReadingMonth ={0}", month);
            sqlStr.AppendFormat(" and IdentifyCode  ='{0}'", identifyCode);
            _QueryStringName = sqlStr.ToString();
        }
    }
}
